<?php
global $_GPC, $_W;
$rid = intval($_GPC['rid']);

$uniacid = $_W['uniacid'];


$reply = pdo_fetch("SELECT * FROM " . tablename('haoman_dpm_reply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$countmoneyreply = pdo_fetch("SELECT * FROM " . tablename('haoman_dpm_countmoneyreply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$yyyreply = pdo_fetch("SELECT isyyy FROM " . tablename('haoman_dpm_yyyreply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$bpreply = pdo_fetch("SELECT * FROM " . tablename('haoman_dpm_bpreply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$xysreply = pdo_fetch("SELECT * FROM " . tablename('haoman_dpm_xysreply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$xyhreply = pdo_fetch("SELECT is_xysjh,is_xyh FROM " . tablename('haoman_dpm_xyhreply') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$shouqian = pdo_fetch("SELECT status,pm_status FROM " . tablename('haoman_dpm_shouqianBase') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));
$video = pdo_fetch("SELECT vodio_bg12 FROM " . tablename('haoman_dpm_mp4') . " WHERE uniacid=:uniacid AND rid = :rid LIMIT 1", array(':uniacid' => $uniacid, ':rid' => $rid));

    //检查登陆状态
    if(!empty($reply['loginpassword'])){
        $cookieid = '__cookie_haoman_dpmweb_201606186_' . $rid;
        $cookie = json_decode(base64_decode($_COOKIE[$cookieid]),true);
        if($cookie['loginpassword'] != $reply['loginpassword']){
            message('登陆密码错误或已超时，请重新输入',$this->createMobileUrl("login",array('id'=>$rid)),'error');
        }
    }
    if($countmoneyreply['pici']==0){
        pdo_update('haoman_dpm_countmoneyreply', array('pici' => 1), array('id' => $countmoneyreply['id']));
    }

    pdo_update('haoman_dpm_countmoneyreply', array('status' => 0), array('id' => $countmoneyreply['id']));


if(empty($countmoneyreply['countmoney_bg'])){
        $bg = "../addons/haoman_base/dpm/bg2.jpg";
    }else{
        $bg = tomedia($countmoneyreply['countmoney_bg']);
    }
    $music = tomedia($countmoneyreply['countmoney_music']);
    if(empty($countmoneyreply['countmoney_begin_music'])){
        $music2 = "../addons/haoman_base/dpm/gameover.mp3"   ;
    }else{
        $music2 = tomedia($countmoneyreply['countmoney_begin_music']);
    }


include $this->template('dpm_countmoney');